With development of computer technology, cache is arranged between processors and mass storage devices to improve processing speed of the processor and reduce difference in access speed between processors and mass storage devices. As the data processing capability of cache is similar to that of the processor, the cache can rapidly receive the data transmitted by the processor and quickly transmit the cached data to the processor.
After configuring the cache, when the data to be read is hit in the cache, the data is directly read from the cache and returned to an upper-layer application. If the data to be read is not hit in the cache, the data is read from a lower-layer mass storage device. At this time, the length of time for reading data will be longer. In the write procedure, when the data to be written is hit in the cache, it is directly written into the cache; if not hit, storage space of the cache will be allocated to write data. The written data is stored in the lower-layer mass storage device during the subsequent flush procedure. Thus, the frequently used data will be stored in the cache to improve data processing capability.